import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {h} from 'vue';
import {Icon} from '/@/components/Icon';

export const columns: BasicColumn[] = [
    {
        title: '菜单名称',
        dataIndex: 'title',
        width: 250,
        align: 'left',
    },
    {
        title: '图标',
        dataIndex: 'icon',
        width: 50,
        customRender: ({record}) => {
            return h(Icon, {icon: record.icon});
        },
    },
    {
        title: '排序',
        dataIndex: 'order_no',
        width: 80,
    },
    {
        title: '权限标识',
        dataIndex: 'scopes',
        width: 180,
    },
    {
        title: '备注',
        dataIndex: 'remark',
    },
];


export const searchFormSchema: FormSchema[] = [
    {
        field: 'title',
        label: '菜单名称',
        component: 'Input',
        colProps: {span: 8},
    },
];

export const formSchema: FormSchema[] = [
    {
        field: 'id',
        label: '菜单ID',
        component: 'Input',
        show: false
    },
    {
        field: 'title',
        label: '菜单名称',
        component: 'Input',
        required: true,
    },
    {
        field: 'icon',
        label: '图标',
        component: 'IconPicker',
    },
    {
        field: 'order_no',
        label: '排序',
        component: 'InputNumber',
    },
    {
        field: 'remark',
        label: '备注',
        component: 'InputTextArea',
    },
];
